package com.yhz.commonutil.common;

/**
 * 错误码
 * @author yanhuanzhan
 * @date 2022/11/13 - 14:40
 */
public enum ErrorCode {
    SUCCESS(200, "ok", ""),
    PARAMS_ERROR(40000, "请求参数错误", ""),
    NULL_ERROR(40001, "请求数据为空", ""),
    NOT_LOGIN(40100, "未登录", ""),
    NO_AUTH(40101, "无权限", ""),
    TOKEN_VALIDATE_FAILED(40200,"令牌验证失败",""),
    SYSTEM_ERROR(50000, "系统内部异常", ""),
    SAVE_ERROR(50010, "新增失败", ""),
    UPDATE_ERROR(50020, "更新失败", ""),
    DELETE_ERROR(50030, "删除失败", ""),
    CODE_ERROR(50040, "验证码错误", ""),
    EMAIL_CODE_EXIT(50050,"邮箱验证码已经发送,一分钟后可重新获取",""),
    SQL_ERROR(50060,"有SQL注入风险",""),
    HTTP_REQ_ERROR(50070, "接口调用失败","" );
    private final int code;

    /**
     * 状态码信息
     */
    private final String message;

    /**
     * 状态码描述（详情）
     */
    private final String description;

    ErrorCode(int code, String message, String description) {
        this.code = code;
        this.message = message;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public String getDescription() {
        return description;
    }
}
